#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>

//#define EXECL
//#define EXECV
//#define EXECLE
//#define EXECVE
//#define EXECLP
//#define EXECVP

int main(int argv, char *argc[])
{
#ifdef EXECL
	if(execl("./exec_app.out", "./exec_app.out", "execl test", NULL) == -1)
	{
		perror("execl:");
	}
#endif
#ifdef EXECV
	char *const arg[] = {"./exec_app.out", "execv test", NULL};
	
	if(execv("./exec_app.out", arg) == -1)
	{
		perror("execv:");
	}
#endif
#ifdef EXECLE
	char *const env[] = {"TEST=execle test", NULL};
	
	if(execle("./exec_app.out", "./exec_app.out", "execle test", NULL, env) == -1)
	{
		perror("execle:");
	}
#endif
#ifdef EXECVE
	char *const arg[] = {"./exec_app.out", "execve test", NULL};
	char *const env[] = {"TEST=execve test", NULL};
	
	if(execve("./exec_app.out", arg, env) == -1)
	{
		perror("execve:");
	}
#endif
#ifdef EXECLP
	if(execlp("ls", "ls", "-l", NULL) == -1)
	{
		perror("execlp:");
	}
#endif
#ifdef EXECVP
	char *const arg[] = {"ls", "-la", NULL};
	
	if(execvp("ls", arg) == -1)
	{
		perror("execvp:");
	}
#endif
	return 0;
}